<h1>My accounts list</h1>

<?=str_replace(array('&lt;','&gt;'),array('<','>'),$this->cms->fetchPageContent('account_mya_list'));?>

<p>
<table class="">
    <thead>
    <tr>
        <th>Platform</th>
		<th>Type</th>
		<th>Account</th>
    </tr>
    </thead>
    <tbody>
	<?php 
			$mt4_accts = new User();
			$mt4_accts->where('email',$user->email)->where('mt4_group NOT IN',"('GM-AUTO','GM-AUTO2','GM-AUTO3')", FALSE)->get();
			
			$mirror_accts = new User();
			$mirror_accts->where('email',$user->email)->where('mt4_group IN',"('GM-AUTO','GM-AUTO2','GM-AUTO3')", FALSE)->get();
	?>
	<?php
			foreach($mt4_accts as $acct){ 
	?>
    <tr>
		<td>MT4</td>
        <td><?php echo (strtolower($acct->type)=='real'?'Live':(preg_match('#^aim$#is', $acct->type)?'AIMS':ucfirst($acct->type))); ?></td>
        <td><?php echo $acct->mt4_uid; ?></td>
    </tr>
    <?php 	} ?>
	<?php
			foreach($mirror_accts as $acct){ 
	?>
    <tr>
		<td>Mirror</td>
        <td>Live</td>
        <td><?php echo $acct->mirror_login_id?$acct->mirror_login_id:'N/A'; ?></td>
    </tr>
    <?php 	} ?>
	
	<?php
			if($mt4_accts->result_count()==0 && $mirror_accts->result_count()==0)
			{
	?>
	<tr><td colspan="3">No records found.</td></tr>
	<?php
			}
	?>
    </tbody>
</table>